<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>九九乘法表</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        .table {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }
        .row {
            display: flex;
            gap: 5px;
        }
        .cell {
            padding: 10px;
            border: 1px solid blue;
            text-align: center;
            color: blue;
            font-size: 18px;
            cursor: pointer;
            transition: background-color 0.3s, color 0.3s;
        }
        .cell:hover {
            background-color: blue;
            color: white;
        }
    </style>
</head>
<body>
    <div class="table" id="multiplication-table"></div>

    <script>
        const table = document.getElementById('multiplication-table');

        for (let i = 1; i <= 9; i++) {  // 控制行数，从1到9
            const row = document.createElement('div');
            row.className = 'row';

            for (let j = 1; j <= i; j++) {  // 每行的列数从1开始到当前行数
                const cell = document.createElement('div');
                cell.className = 'cell';
                cell.textContent = `${j} × ${i} = ${i * j}`;
                row.appendChild(cell);
            }

            table.appendChild(row);  // 将每一行添加到表格容器中
        }
    </script>
</body>
</html>



